#团队表，用以存储团队的信息
class CreateTeams < ActiveRecord::Migration
  def self.up
    create_table :teams do |t|
      t.string    :name                                           #团队名称
      t.integer   :worker_id                                      #组长ID
      t.integer   :is_locked     ,:limit => 1 ,:default => 0      #锁定 1为True 0为False
      t.integer   :lock_version  ,:default => 0                   #乐观锁
      t.timestamps
    end
    Team.create(:name => "ATP")
    Team.create(:name => "CIR")
    Team.create(:name => "LKJ")
    Team.create(:name => "A组")
    Team.create(:name => "B组")
  end

  def self.down
    drop_table :teams
  end
end
